<extend name="Public/base"/>
<block name="content">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">提币管理</strong>  <small></small></div>
            </div>
            <!--<li class="texuu" id="1" m="2" n="4" x="1"><a href="#">teset</a></li>-->
            <hr>

            <form class="am-g" action="{:U()}" method="get">
                <select data-am-selected="{btnSize: 'sm'}" name="status">
                    <option value="0" <php>if($status == "") echo 'selected'</php>>全部</option>
                    <option value="2" <php>if($status == 2) echo 'selected'</php>>待审核</option>
                    <option value="1" <php>if($status == 1) echo 'selected'</php>>已完成</option>
                    <!--<option value="3" <php>if($status == 3) echo 'selected'</php>>已驳回</option>-->
                    <option value="3" <php>if($status == 3) echo 'selected'</php>>失败</option>
                </select>

                <div class="am-u-sm-12 am-u-md-2">
                    <div class="am-input-group am-input-group-sm">
                        <input type="text" class="am-form-field" name="username" value="{$username}" placeholder="会员用户名">
                    </div>
                </div>

                <div class="am-u-sm-12 am-u-md-2">
                    <div class="am-input-group am-input-group-sm">
                        <select name="coinname" id="">
                            <option value="" <if condition="$coinname eq ''">selected</if>>提币币种</option>
                            <option value="2" <if condition="$coinname eq 2">selected</if>>DACM</option>
                            <option value="8" <if condition="$coinname eq 8">selected</if>>USDT</option>
                            <!--<option value="10" <if condition="$coinname eq 10">selected</if>>USDT-OMNI</option>-->
                        </select>
                    </div>
                </div>
                <!--<input type="text" class="" name="phone" value="{$phone}"  placeholder="手机号查询">-->
                <input type="text" class="" name="address" value="{$address}"  placeholder="提币地址查询" style="width: 400px">
                <button class="am-btn am-btn-primary" type="submit">搜索</button>
                <!-- <div class="am-u-sm-12 am-u-md-1">
                  <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                      <a href="{:U('user/exportOrder')}" type="button" class="am-btn am-btn-primary"><span class="am-icon-plus"></span>提现未处理</a>
                    </div>
                  </div>

                </div>
                <div class="am-u-sm-12 am-u-md-1">
                  <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                      <a href="{:U('user/exportOrder1')}" type="button" class="am-btn am-btn-primary"><span class="am-icon-plus"></span>提现已处理</a>
                    </div>
                  </div>

                </div> -->
                <!--   <div class="am-u-sm-12 am-u-md-2">
                    <input type="text" class="am-form-field" name="start_time"  value="{$start_time}" placeholder="开始时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',readOnly:true})" readonly/>
                  </div>
                  <div class="am-u-sm-12 am-u-md-2">
                    <input type="text" class="am-form-field" name="end_time"  value="{$end_time}" placeholder="结束时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',readOnly:true})" readonly/>
                  </div>
                  <div class="am-u-sm-12 am-u-md-2">
                    <div class="am-input-group am-input-group-sm">
                      <input type="text" class="am-form-field" name="username" value="{$username}" placeholder="会员用户名">
                    </div>
                  </div>
                  <div class="am-u-sm-12 am-u-md-2">
                    <div class="am-form-group">
                      <select data-am-selected="{btnSize: 'sm'}" name="status">
                        <option value="2" <php>if($status == 2) echo 'selected'</php>>待审核</option>
                        <option value="1" <php>if($status == 1) echo 'selected'</php>>已完成</option>
                        <option value="3" <php>if($status == 3) echo 'selected'</php>>已驳回</option>
                      </select>
                    <!--</div>-->
                <!--</div>-->

                <!-- <div class="am-u-sm-12 am-u-md-2">
                  <div class="am-input-group am-input-group-sm">

                    <span class="am-input-group-btn">
                    <button class="am-btn am-btn-primary" type="submit">搜索</button>
                  </span>
                  </div>
                </div> -->

                <div class="am-u-sm-12 am-u-md-1">
                    <div class="am-input-group am-input-group-sm">
                        <input class="am-btn am-btn-primary" value="导出" type="submit" id="export"/>
                        <!--</span>-->
                    </div>
                </div>
            </form>
            <style>
                .red{
                    color: red;
                }
            </style>
            <div>
                提币以太坊地址：0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E----
                钱包USDT剩余: <span class="usdt red"></span>----
                <!--钱包EXUU剩余：<span class="exuu red"></span>-->
                钱包DACM剩余：<span class="dacm red"></span>
                <br>
                <!--提币OMNI地址：1Jdg9xfqkyM24hJLaUK6b738JST4XyNmwW&#45;&#45;&#45;&#45;-->
                <!--钱包USDT-OMNI剩余：<span class="red">{$omni}</span>-->
            </div>

            <!--<button class="am-btn am-btn-primary yijian">一键通过</button>-->
            <span class="auto_value"></span>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <div class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr>
                                <!--<th><input type="checkbox" id="all"></th>-->
                                <th class="table-title">序号</th>
                                <th class="table-set">操作</th>
                                <th class="table-title">用户ID</th>
                                <th class="table-title">用户名</th>
                                <!--<th class="table-title">手机号</th>-->
                                <th class="table-type">币种名称</th>
                                <th class="table-type">提币地址</th>
                                <th class="table-type">提币数量</th>
                                <th class="table-type">实际提币(扣手续费)</th>
                                <th class="table-type">交易hash</th>
                                <!-- <th class="table-type">到账金额</th> -->
                                <th class="table-type">状态</th>
                                <th class="table-type">手续费</th>
                                <th class="table-date am-hide-sm-only">提交时间</th>
                                <th class="table-date am-hide-sm-only">确认时间</th>
                                <!--<th class="table-date am-hide-sm-only">平台钱包</th>-->

                            </tr>
                            </thead>
                            <tbody>
                            <empty name="data">
                                <tr>
                                    <td>暂无数据</td>
                                </tr>
                            </empty>
                            <php>
                                $tixian = C('WITHDRAW_STATUS');
                                $type = C('account_type');
                            </php>
                            <volist name="data" id="vo">
                                <tr>
                                    <!--<td>-->
                                        <!--<if condition="$vo.status eq 2">-->
                                            <!--<input type="checkbox" class="every" id="{$vo.id}" value="{$vo.id}" coin="{$vo.coinname}" n="{$vo.address}" x="{$vo.id}" m="{$vo.amount}">-->
                                        <!--</if>-->
                                    <!--</td>-->
                                    <td>{$vo['id']}</td>
                                    <td>
                                        <if condition="$vo['status'] eq 2">

                                            <!-- 操作BTC -->
                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq btc">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="tbtc" id="{$vo['id']}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>

                                            <!-- 操作ETH -->
                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq eth">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="teth" id="{$vo['id']}" m="{$vo.amount}" n="{$vo.address}" x="{$vo.id}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>

                                            <!-- 操作USDT -->

                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq usdt">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="tusdt" id="{$vo['id']}" m="{$vo.amount}" n="{$vo.address}" x="{$vo.id}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>


                                            <!-- 操作dacm -->

                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq dacm">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="tdacm" id="{$vo['id']}" m="{$vo.amount}" n="{$vo.address}" x="{$vo.id}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>

                                            <!-- 操作EXUU -->

                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq exuu">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="texuu" id="{$vo['id']}" m="{$vo.amount}" n="{$vo.address}" x="{$vo.id}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>


                                            <!-- 操作USDT-OMNI -->

                                            <if condition="$vo['status'] eq 2 AND $vo['coinname'] eq usdtomni">

                                                <div class="am-dropdown" data-am-dropdown="">

                                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle=""><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>

                                                    <ul class="am-dropdown-content">

                                                        <li class="tusdtomni" id="{$vo['id']}" m="{$vo.amount}" n="{$vo.address}" x="{$vo.id}"><a href="#">待审核</a></li>

                                                        <li><a href="{:U('doReject',array('id'=>$vo['id'],'status'=>3,'userid'=>$vo['userid'],'amount'=>$vo['ti_amount'],'coinname'=>$vo['coinname']))}">待驳回</a></li>

                                                    </ul>

                                                </div>

                                            </if>


                                            <else/>
                                            ---
                                        </if>
                                    </td>
                                    <td>{$vo['userid']}</td>
                                    <td>{$vo['username']}</td>
                                    <!--<td><a href="#">{$vo['phone']}</a></td>-->
                                    <td><a href="#">{$vo['coinname']|strtoupper}</a></td>
                                    <!--<td><a href="#">{$vo['address']}</a></td>-->

                                    <if condition="$vo['coinname'] eq btc">
                                        <td><a href="https://btc.com/{$vo['address']}" target="_blank">
                                        {$vo['address']}</a></td>
                                        <elseif condition="$vo['coinname'] eq usdtomni"/>
                                        <td><a href="https://omniexplorer.info/address/{$vo['address']}" target="_blank">
                                            {$vo['address']}</a></td>
                                        <else />

                                        <!--<td><a href="https://etherscan.io/address/{$vo['address']}" target="_blank">{$vo['address']}</a></td>-->
                                        <td><a href="https://cn.etherscan.com/address/{$vo['address']}#tokentxns" target="_blank">{$vo['address']}</a></td>
                                    </if>
                                    <td>{$vo['ti_amount']}</td>
                                    <td>{$vo['amount']}</td>

                                    <!-- <td>{$vo['sxf']}</td> -->
                                    <!-- <td>{$vo['amount'] - $vo['sxf']}</td> -->
                                    <if condition="$vo['coinname'] eq btc">
                                        <td><a href="https://btc.com/{$vo['hash']}" target="_blank">
                                        {$vo['hash']}</a></td>
                                     <elseif condition="$vo['coinname'] eq usdtomni"/>
                                        <td><a href="https://omniexplorer.info/tx/{$vo['hash']}" target="_blank">
                                            {$vo['hash']}</a></td>
                                     <else/>
                                        <!--<td><a href="https://etherscan.io/tx/{$vo['hash']}" target="_blank">{$vo['hash']}</a></td>-->
                                        <td><a href="https://cn.etherscan.com/tx/{$vo['hash']}" target="_blank">{$vo['hash']}</a></td>
                                    </if>
                                    <td>
                                        {$tixian[$vo['status']]}
                                    </td>
                                    <td>{$vo['fee']}</td>
                                    <!-- <td class="am-hide-sm-only">
                                        {$vo['bank_num']}
                                    </td>
                                    <td class="am-hide-sm-only">
                                      {$vo['bank_name']}
                                    </td> -->

                                    <!-- <td class="am-hide-sm-only">
                                      {$vo['bank_tree']}
                                    </td>
                                    <td class="am-hide-sm-only">
                                      {$vo['bank_user']}
                                    </td>
                                    <td class="am-hide-sm-only">
                                      {$vo['weixin']}
                                    </td>
                                    <td class="am-hide-sm-only">
                                      {$vo['zfb']}
                                    </td> -->
                                    <td class="am-hide-sm-only">{$vo['addtime']|date="Y-m-d H:i:s",###}</td>
                                    <if condition="$vo['endtime'] eq 0">
                                        <td class="am-hide-sm-only">---</td>
                                        <else/>

                                        <td class="am-hide-sm-only">{$vo['endtime']|date="Y-m-d H:i:s",###}</td>

                                    </if>

                                    <!--<td>-->

                                        <!--<if condition="$vo['coinname'] eq btc">-->

                                            <!--{$balance}-->

                                            <!--<elseif condition="$vo['coinname'] eq eth" />-->

                                            <!--<span class="eth"></span>-->

                                            <!--<elseif condition="$vo['coinname'] eq usdt" />-->

                                            <!--<span class="usdt"></span>-->

                                            <!--<elseif condition="$vo['coinname'] eq dacm" />-->

                                            <!--<span class="dacm"></span>-->

                                            <!--<elseif condition="$vo['coinname'] eq exuu" />-->

                                            <!--<span class="exuu"></span>-->

                                        <!--</if>-->

                                    <!--</td>-->


                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <div class="am-cf">
                            共 {$count} 条记录
                            <div class="am-fr">
                                <ul class="am-pagination">
                                    {$page}

                                </ul>
                            </div>
                        </div>
                        <hr/>
                    </div>

                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2020 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>

    <!-- 引入js -->

    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="/Public/Home/js/web3.1.js"></script>
    <!--<script src="__PUBLIC__/Admin/js/withdrawcoin.js"></script>-->

    <!-- 查询平台钱包和转账 -->

    <script type="text/javascript">

        $('#all').click(function () {
            // console.log(this.checked);
            // $(".every").attr('checked',this.checked);
            $(".every").prop('checked',this.checked);
        })

        $('.every').click(function () {
            $flag=true;
            $(".every").each(function () {
                if(!this.checked){
                    $flag=false;
                }
            })
            $("#all").prop('checked',$flag);
        })

        $(".yijian").click(function () {
            // alert(123);return false;
            $flag=true;
            if(confirm("确定执行此操作吗")){
                $arr=[];
                $(".every").each(function () {
                    if(this.checked){
                        $arr.push($(this).val());
                        // alert($(this).attr('n'));
                        if($(this).attr('coin')=='dacm'){
                            tdacm($(this));
                        }
                        if($(this).attr('coin')=='btc'){
                            // tdacm();
                            tbtc($(this));
                        }
                        if($(this).attr('coin')=='eth'){
                            // tdacm();
                            teth($(this));
                        }
                        if($(this).attr('coin')=='usdt'){
                            // tdacm();
                            tusdt($(this));
                        }
                    }
                });
                if($flag==true){
                    alert('批量审核已完成');
                    window.location.reload();
                }else {
                    alert('部分会员审核未通过，请手动驳回');
                    window.location.reload();
                }
                // window.location.reload();
                // alert($arr+"||"+$flag);
                // $.ajax({
                //     type:"post",
                //     dataType:"json",
                //     url:"{:U('yijian_sure')}",
                //     data:{
                //         arr:$arr,
                //     },
                //     success:function (data) {
                //         if(data.code>0){
                //             alert(data.message);
                //             window.location.reload();
                //         }else {
                //             alert(data.message);
                //         }
                //     }
                // })
            }

        })


        if (typeof web3 !== 'undefined') {
            web3 = new Web3(web3.currentProvider);
        }
        else {
            // web3 = new Web3('https://mainnet.infura.io/JLEYzEEavNnSni91CvPF');
            web3 = new Web3('https://mainnet.infura.io/v3/5181036381c1452297fe158e84424447');
        }


        // var address = "0x5F19Baa54Cd1e887dFe86Db9b14dC137bE94b88D";
        var address = "0xeE7D927A0F94cC61889b029Fc8e7Beb9f137793A";

        //查询eth余额
        var eth = '';
        web3.eth.getBalance(address, function(err, resp){
            if(!err){
                eth = web3.utils.fromWei(resp, 'ether');
                $(".eth").append(eth);
            }else{
                console.log(err);
            }
        });

        var dacmAddress='0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E';
        //查询dacm余额
        var dacmContractAddress = '0xe177dcd5a62485bb6ddbcbcc71852575d5b47512';
        var dacmContract = new web3.eth.Contract([{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setTransferAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"setReleaseAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"burnAmount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"mintAgents","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setMintAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"}],"name":"setTokenInformation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradeAgent","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"releaseTokenTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradeMaster","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setLockAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"fromWhom","type":"address"}],"name":"transferToOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getUpgradeState","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"transferAgents","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"released","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"canUpgrade","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"lockAddresses","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalUpgraded","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"releaseAgent","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"agent","type":"address"}],"name":"setUpgradeAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isToken","outputs":[{"name":"weAre","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"BURN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"master","type":"address"}],"name":"setUpgradeMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_initialSupply","type":"uint256"},{"name":"_decimals","type":"uint256"},{"name":"_mintable","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"fromWhom","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"OwnerReclaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newName","type":"string"},{"indexed":false,"name":"newSymbol","type":"string"}],"name":"UpdatedTokenInformation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"agent","type":"address"}],"name":"UpgradeAgentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"state","type":"bool"}],"name":"MintingAgentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"receiver","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"burner","type":"address"},{"indexed":false,"name":"burnedAmount","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}], dacmContractAddress, {
            from : '0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E'
        });

        var dacm = '';
        dacmContract.methods.balanceOf(dacmAddress).call(function(err, tkns){
            if (!err) {
                dacm = web3.utils.fromWei(tkns, 'ether');
                $(".dacm").append(dacm);
            }else{
                console.log(err)
            }

        });

        //查询usdt余额
        var usdtContractAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7';
        var usdtContract = new web3.eth.Contract([{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setTransferAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"setReleaseAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"burnAmount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"mintAgents","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setMintAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"}],"name":"setTokenInformation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradeAgent","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"releaseTokenTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradeMaster","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"state","type":"bool"}],"name":"setLockAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"fromWhom","type":"address"}],"name":"transferToOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getUpgradeState","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"transferAgents","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"released","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"canUpgrade","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"lockAddresses","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalUpgraded","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"releaseAgent","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"agent","type":"address"}],"name":"setUpgradeAgent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isToken","outputs":[{"name":"weAre","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"BURN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"master","type":"address"}],"name":"setUpgradeMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_initialSupply","type":"uint256"},{"name":"_decimals","type":"uint256"},{"name":"_mintable","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"fromWhom","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"OwnerReclaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newName","type":"string"},{"indexed":false,"name":"newSymbol","type":"string"}],"name":"UpdatedTokenInformation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"agent","type":"address"}],"name":"UpgradeAgentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"state","type":"bool"}],"name":"MintingAgentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"receiver","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"burner","type":"address"},{"indexed":false,"name":"burnedAmount","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}], usdtContractAddress, {
            from : '0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E'
        });

        var usdt = '';
        usdtContract.methods.balanceOf(dacmAddress).call(function(err, tkns){
            if (!err) {
                usdt = web3.utils.fromWei(tkns, 'mwei');
                $(".usdt").append(usdt);
            }else{
                console.log(err)
            }

        });


        //查询EXUU余额
        // var exuuContractAddress = '0xa4c23a3ab707ef42c004c7e8fadf49c7448e237a';
        // var exuuContract = new web3.eth.Contract([{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialAmount","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}], exuuContractAddress, {
        //     from : '0xeE7D927A0F94cC61889b029Fc8e7Beb9f137793A'
        // });
        //
        // var exuu = '';
        // exuuContract.methods.balanceOf(address).call(function(err, tkns){
        //     if (!err) {
        //         exuu = web3.utils.fromWei(tkns, 'ether');
        //         $(".exuu").append(exuu);
        //     }else{
        //         console.log(err)
        //     }
        //
        // })


        //btc转账
        $('.tbtc').click(function(event) {

            // alert('暂未开放！');
            // return false;

            if(confirm("确认操作？")){

                var id = $(this).attr('id');

                $.ajax({
                    type: 'POST',
                    url: '{:U("doWithdrawBTC")}',
                    data: {
                        'id':id
                    },

                    dataType: 'json',

                    success: function(data){
                        if (data.code == 0) {
                            alert(data.msg);
                            window.location.reload();
                            return;
                        } else {
                            alert(data.msg);
                            window.location.reload();
                            // window.location ="{:U('withdrawCoin')}";
                        }

                    }
                });

            }
            else
            {
                return;
            }
        });

        //usdt-omni转账
        $('.tusdtomni').click(function () {
            if(confirm("确认操作？")){

                var id = $(this).attr('id');

                $.ajax({
                    type: 'POST',
                    url: '{:U("doWithdrawUSDTOMNI")}',
                    data: {
                        'id':id
                    },

                    dataType: 'json',

                    success: function(data){
                        if (data.code == 0) {
                            alert(data.msg);
                            window.location.reload();
                            return;
                        } else {
                            alert(data.msg);
                            window.location.reload();
                            // window.location ="{:U('withdrawCoin')}";
                        }

                    }
                });

            }
            else
            {
                return;
            }
        })

        //eth转账
        $('.teth').click(function(){

            // alert('暂未开放！');
            // return false;

            if(confirm("确认操作？")){
                layer.open({
                    type: 1,
                    title:'输入密码',
                    skin:'layui-layer-rim',
                    area:['450px', 'auto'],
                    content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                        +'<div class="col-sm-12">'
                        +'<div class="input-group">'
                        +'<input id="password" style="width: 100%" class="form-control"/>'
                        // +'<textarea id="beizhu" style="width: 100%" class="form-control" >'
                        // +'</textarea>'
                        +'</div>'
                        +'</div>'
                        +'</div>'
                    ,
                    btn:['提交','取消'],
                    btn1: function (index,layero) {
                        var password = $('#password').val();
                        $.post("{:U('Public/verify_password')}",{password:password},function (data) {
                            if(data.code>0){
                                layer.msg('验证成功',{time:1000},function () {
                                    var from = '0xF4aC5D9be4aEa89b4e607752bcBD31D0A7dFfE16';
                                    var amount = parseFloat($(this).attr("m"));
                                    var number = parseFloat($(this).attr("m"));
                                    var to = $(this).attr("n");
                                    var id = $(this).attr('x');

                                    if(!web3.utils.isAddress(to)){
                                        alert('ETH钱包地址不正确');
                                        return false;
                                    }

                                    web3.eth.getBalance(from, function(err, resp){
                                        if(!err){

                                            balance = web3.utils.fromWei(resp, 'ether');
                                            console.log(balance);
                                            web3.eth.getGasPrice(function(err, res){
                                                if(!err)
                                                {
                                                    price = web3.utils.fromWei(res, 'ether');
                                                    //console.log(price);
                                                    limit = 26000;
                                                    fee = parseFloat(price) * limit;
                                                    //console.log(fee);
                                                    //console.log(number);
                                                    num = parseFloat(fee) + parseFloat(number);
                                                    //console.log(fee);
                                                    //console.log(number);
                                                    //console.log(num);
                                                    if(parseFloat(num) > parseFloat(balance))
                                                    {
                                                        alert('平台钱包ETH余额不足');
                                                        return false;
                                                    }
                                                }
                                            });

                                        }else{
                                            console.log(err);
                                        }
                                    });

                                    web3.eth.getTransactionCount(from, function(err, count){
                                        if(!err){

                                            var tcount = count;
                                            amount = web3.utils.toWei(amount.toString());
                                            web3.eth.getGasPrice().then(function(gasPrice){
                                                var rawTransaction = {
                                                    "from": from,
                                                    "nonce": "0x" + tcount.toString(16),
                                                    "gasPrice": web3.utils.toHex(gasPrice),
                                                    "gasLimit": web3.utils.toHex(26000),
                                                    "to": to,
                                                    "value": amount,
                                                    "data": ''
                                                };

                                                var privKey = data.msg;

                                                web3.eth.accounts.signTransaction(rawTransaction, privKey, function(err,signed){
                                                    if(err){
                                                        console.log(err);
                                                        return ;
                                                    }
                                                    web3.eth.sendSignedTransaction(signed.rawTransaction, function(err, result){
                                                        if(!err){
                                                            console.log(result);
                                                            //传送数据
                                                            $.ajax({
                                                                type: 'POST',
                                                                url: '{:U("doWithdrawETH")}',
                                                                data: {
                                                                    'txhash': result,
                                                                    'id' : id
                                                                },
                                                                dataType: 'json',

                                                                success: function(data){
                                                                    if (data.code == 0) {
                                                                        alert(data.msg);
                                                                        window.location.reload();
                                                                        // window.location ="{:U('withdrawCoin')}";
                                                                    } else {
                                                                        alert(data.msg);
                                                                        return;
                                                                    }

                                                                }
                                                            });
                                                        }else{
                                                            console.log(err);
                                                        }
                                                    })
                                                })

                                            })

                                        }else{
                                            console.log(error);
                                        }
                                    });

                                });return false;
                            }else{layer.msg(data.msg,{time:1000});return false; }
                        },'json')
                    },
                    btn2:function (index,layero) {
                        layer.close(index);
                    }
                });

            }
            else
            {
                return;
            }

        });


        //usdt转账
        $('.tusdt').click(function(){
            var tibi = $(this);
            if(confirm("确认操作？")){
                layer.open({
                    type: 1,
                    title:'输入密码',
                    skin:'layui-layer-rim',
                    area:['450px', 'auto'],
                    content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                        +'<div class="col-sm-12">'
                        +'<div class="input-group">'
                        +'<input id="password" style="width: 100%" class="form-control"/>'
                        // +'<textarea id="beizhu" style="width: 100%" class="form-control" >'
                        // +'</textarea>'
                        +'</div>'
                        +'</div>'
                        +'</div>'
                    ,
                    btn:['提交','取消'],
                    btn1: function (index,layero) {
                        var password = $('#password').val();
                        $.post("{:U('Public/verify_password')}",{password:password},function (data) {
                            if(data.code>0){
                                layer.msg('验证成功',{time:1000},function(){
                                    var id = tibi.attr('x');
                                    $.ajax({
                                        type: 'POST',
                                        url: '{:U("doWithdrawETH")}',
                                        data: {
                                            'txhash': '123456',
                                            'id' : id
                                        },
                                        dataType: 'json',

                                        success: function(data){

                                            if (data.code == 0) {
                                                alert(data.msg);
                                                window.location.reload();
                                                // window.location ="{:U('withdrawCoin')}";
                                            } else {
                                                alert(data.msg);
                                                tibi.attr('disabled',false).css('pointer-events','auto')
                                                return;
                                            }

                                        }
                                    });
                                });return false;
                                // layer.msg('验证成功',{time:1000},function () {
                                //     // var from = '0xeE7D927A0F94cC61889b029Fc8e7Beb9f137793A';
                                //     var from = '0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E';
                                //     var amount = parseFloat(tibi.attr("m"));
                                //
                                //     // var amount = parseFloat(2000);
                                //     var to = tibi.attr("n");
                                //     var id = tibi.attr('x');
                                //
                                //     //验证数量
                                //     if(!web3.utils.isAddress(to)){
                                //         alert('钱包地址不正确');
                                //         return false;
                                //     }
                                //     tibi.attr('disabled',true).css('pointer-events','none')
                                //
                                //     web3.eth.getTransactionCount(from, function(err, count){
                                //
                                //         if(!err){
                                //             var tcount = count;
                                //             usdtContract.methods.balanceOf(from).call( function(err, tkns){
                                //                 if (!err) {
                                //                     var balance = web3.utils.fromWei(tkns, 'mwei');
                                //                     console.log(balance);
                                //                     var b = new web3.utils.BN(balance)
                                //
                                //                     // console.log(b.toNumber());
                                //                     // console.log(amount);return false;
                                //                     if(parseFloat(balance) < amount){
                                //                         alert('平台钱包USDT余额不足');
                                //                         tibi.attr('disabled',false).css('pointer-events','auto')
                                //                         return false;
                                //                     }
                                //
                                //                     // return false;
                                //                     amount = web3.utils.toWei(amount.toString(), 'mwei');
                                //
                                //                     web3.eth.getGasPrice().then(function(gasPrice){
                                //
                                //                         var rawTransaction = {
                                //                             "from": from,
                                //                             "nonce": "0x" + tcount.toString(16),
                                //                             "gasPrice": web3.utils.toHex(gasPrice),
                                //                             "gasLimit": web3.utils.toHex(60000),
                                //                             "to": usdtContractAddress,
                                //                             "value": "0x0",
                                //                             "data": usdtContract.methods.transfer(to, amount).encodeABI()
                                //                         };
                                //
                                //
                                //                         var privKey =data.msg;
                                //
                                //                         web3.eth.accounts.signTransaction(rawTransaction, privKey, function(err,signed){
                                //
                                //                             if(err){
                                //                                 console.log(err);
                                //                                 return ;
                                //                             }
                                //
                                //                             web3.eth.sendSignedTransaction(signed.rawTransaction, function(err, result){
                                //                                 if(!err){
                                //                                     //传送数据
                                //                                     $.ajax({
                                //                                         type: 'POST',
                                //                                         url: '{:U("doWithdrawETH")}',
                                //                                         data: {
                                //                                             'txhash': result,
                                //                                             'id' : id
                                //                                         },
                                //                                         dataType: 'json',
                                //
                                //                                         success: function(data){
                                //
                                //                                             if (data.code == 0) {
                                //                                                 alert(data.msg);
                                //                                                 window.location.reload();
                                //                                                 // window.location ="{:U('withdrawCoin')}";
                                //                                             } else {
                                //                                                 alert(data.msg);
                                //                                                 tibi.attr('disabled',false).css('pointer-events','auto')
                                //                                                 return;
                                //                                             }
                                //
                                //                                         }
                                //                                     });
                                //                                 }else{
                                //                                     console.log(err);
                                //                                 }
                                //                             })
                                //                         })
                                //
                                //                     })
                                //
                                //                 }else{
                                //                     console.log(err)
                                //                 }
                                //
                                //             })
                                //         }else{
                                //             console.log(error);
                                //         }
                                //
                                //     });
                                //
                                //
                                // });return false;

                            }else{layer.msg(data.msg,{time:1000});return false; }
                        },'json')
                    },
                    btn2:function (index,layero) {
                        layer.close(index);
                    }
                });




            }
            else
            {
                return;
            }

        });

        //dacm转账
        $('.tdacm').click(function(){
            //alert('暂未开放！');
            //return false;
            var tibi = $(this);
            if(confirm("确认操作？")){
                layer.open({
                    type: 1,
                    title:'输入密码',
                    skin:'layui-layer-rim',
                    area:['450px', 'auto'],
                    content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                        +'<div class="col-sm-12">'
                        +'<div class="input-group">'
                        +'<input id="password" style="width: 100%" class="form-control"/>'
                        // +'<textarea id="beizhu" style="width: 100%" class="form-control" >'
                        // +'</textarea>'
                        +'</div>'
                        +'</div>'
                        +'</div>'
                    ,
                    btn:['提交','取消'],
                    btn1: function (index,layero) {
                        var password = $('#password').val();
                        $.post("{:U('Public/verify_password')}",{password:password},function (data) {
                            if(data.code>0){
                                layer.msg('验证成功',{time:1000},function(){
                                    var id = tibi.attr('x');
                                    //传送数据
                                    $.ajax({
                                        type: 'POST',
                                        url: '{:U("doWithdrawETH")}',
                                        data: {
                                            'txhash': '123456',
                                            'id' : id
                                        },
                                        dataType: 'json',

                                        success: function(data){

                                            //提币失败
                                            if (data.code == 0) {
                                                alert(data.msg);
                                                window.location.reload();
                                                // window.location ="{:U('withdrawCoin')}";
                                            } else {
                                                alert(data.msg);
                                                window.location.reload();
                                                return;
                                            }

                                        }
                                    });
                                });
                                // layer.msg('验证成功',{time:1000},function () {
                                //     //提币
                                //     var from = '0x6BaaEfCe6031c7bc51a6e41076099ee799b5B51E';
                                //     var amount = parseFloat(tibi.attr("m"));
                                //
                                //     var to = tibi.attr("n");
                                //     var id = tibi.attr('x');
                                //
                                //     //验证数量
                                //     if(!web3.utils.isAddress(to)){
                                //         alert('钱包地址不正确');
                                //         return false;
                                //     }
                                //      <!--alert(to);-->
                                //     <!--return false;-->
                                //     tibi.attr('disabled',true).css('pointer-events','none')
                                //     web3.eth.getTransactionCount(from, function(err, count){
                                //         if(!err){
                                //             var tcount = count;
                                //             dacmContract.methods.balanceOf(from).call( function(err, tkns){
                                //                 if (!err) {
                                //                     var balance = web3.utils.fromWei(tkns, 'ether');
                                //                     console.log(balance);
                                //                     var b = new web3.utils.BN(balance)
                                //
                                //                     if(b.toNumber() < amount){
                                //                         alert('平台钱包dacm余额不足');
                                //                         tibi.attr('disabled',false).css('pointer-events','auto')
                                //                         return false;
                                //                     }
                                //                     amount = web3.utils.toWei(amount.toString());
                                //                     web3.eth.getGasPrice().then(function(gasPrice){
                                //                         var rawTransaction = {
                                //                             "from": from,
                                //                             "nonce": "0x" + tcount.toString(16),
                                //                             "gasPrice": web3.utils.toHex(gasPrice),
                                //                             "gasLimit": web3.utils.toHex(60000),
                                //                             "to": dacmContractAddress,
                                //                             "value": "0x0",
                                //                             "data": dacmContract.methods.transfer(to, amount).encodeABI()
                                //                         };
                                //                         var privKey = data.msg;
                                //                         web3.eth.accounts.signTransaction(rawTransaction, privKey, function(err,signed){
                                //                             if(err){
                                //                                 console.log(err);
                                //                                 return ;
                                //                             }
                                //                             web3.eth.sendSignedTransaction(signed.rawTransaction, function(err, result){
                                //                                 if(!err){
                                //                                     //传送数据
                                //                                     $.ajax({
                                //                                         type: 'POST',
                                //                                         url: '{:U("doWithdrawETH")}',
                                //                                         data: {
                                //                                             'txhash': result,
                                //                                             'id' : id
                                //                                         },
                                //                                         dataType: 'json',
                                //
                                //                                         success: function(data){
                                //
                                //                                             //提币失败
                                //                                             if (data.code == 0) {
                                //                                                 alert(data.msg);
                                //                                                 window.location.reload();
                                //                                                 // window.location ="{:U('withdrawCoin')}";
                                //                                             } else {
                                //                                                 alert(data.msg);
                                //                                                 window.location.reload();
                                //                                                 return;
                                //                                             }
                                //
                                //                                         }
                                //                                     });
                                //                                 }else{
                                //                                     console.log(err);
                                //                                 }
                                //                             })
                                //                         })
                                //
                                //                     })
                                //
                                //                 }else{
                                //                     console.log(err)
                                //                 }
                                //
                                //             })
                                //         }else{
                                //             console.log(error);
                                //         }
                                //     });
                                // });return false;
                            }else{layer.msg(data.msg,{time:1000});return false; }
                        },'json')
                    },
                    btn2:function (index,layero) {
                        layer.close(index);
                    }
                });


            } else { return;}

        });

        //EXUU转账
        $('.texuu').click(function(){
            //alert('暂未开放！');
            //return false;
            if(confirm("确认操作？")){
                layer.open({
                    type: 1,
                    title:'输入密码',
                    skin:'layui-layer-rim',
                    area:['450px', 'auto'],
                    content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                        +'<div class="col-sm-12">'
                        +'<div class="input-group">'
                            +'<input id="password" style="width: 100%" class="form-control"/>'
                        // +'<textarea id="beizhu" style="width: 100%" class="form-control" >'
                        // +'</textarea>'
                        +'</div>'
                        +'</div>'
                        +'</div>'
                    ,
                    btn:['提交','取消'],
                    btn1: function (index,layero) {
                        var password = $('#password').val();
                        $.post("{:U('Public/verify_password')}",{password:password},function (data) {
                            if(data.code>0){
                                layer.msg(data.msg,{time:1000},function () {

                                });return false;
                            }else{layer.msg(data.msg,{time:1000});return false; }
                        },'json')
                    },
                    btn2:function (index,layero) {
                        layer.close(index);
                    }
                });
                var from = '0xeE7D927A0F94cC61889b029Fc8e7Beb9f137793A';
                var amount = parseFloat($(this).attr("m"));

                var to = $(this).attr("n");
                var id = $(this).attr('x');

                //验证数量
                if(!web3.utils.isAddress(to)){
                    alert('钱包地址不正确');
                    return false;
                }

                web3.eth.getTransactionCount(from, function(err, count){

                    if(!err){
                        var tcount = count;
                        exuuContract.methods.balanceOf(from).call( function(err, tkns){
                            if (!err) {
                                var balance = web3.utils.fromWei(tkns, 'ether');
                                console.log(balance);
                                var b = new web3.utils.BN(balance)

                                console.log(b.toNumber())
                                if(b.toNumber() < amount){
                                    alert('平台钱包EXUU余额不足');
                                    return false;
                                }


                                // return false;
                                amount = web3.utils.toWei(amount.toString());

                                web3.eth.getGasPrice().then(function(gasPrice){

                                    var rawTransaction = {
                                        "from": from,
                                        "nonce": "0x" + tcount.toString(16),
                                        "gasPrice": web3.utils.toHex(gasPrice),
                                        "gasLimit": web3.utils.toHex(60000),
                                        "to": exuuContractAddress,
                                        "value": "0x0",
                                        "data": exuuContract.methods.transfer(to, amount).encodeABI()
                                    };

                                    // var privKey = '0xD4F454B56C7CA17B9CA187A4968CE4F69A727C497F60604C8C3766C89409C54C';
                                    var privKey = '0xcce0d1a54a85c3c6e0dfe8089f182d5ed60aa586410ed510daa402488813ae2e';

                                    web3.eth.accounts.signTransaction(rawTransaction, privKey, function(err,signed){

                                        if(err){
                                            console.log(err);
                                            return ;
                                        }

                                        web3.eth.sendSignedTransaction(signed.rawTransaction, function(err, result){

                                            console.log(result);

                                            if(!err){
                                                //传送数据
                                                $.ajax({
                                                    type: 'POST',
                                                    url: '{:U("doWithdrawETH")}',
                                                    data: {
                                                        'txhash': result,
                                                        'id' : id
                                                    },
                                                    dataType: 'json',

                                                    success: function(data){
                                                        //提币失败
                                                        if (data.code == 0) {
                                                            alert(data.msg);
                                                            window.location.reload();
                                                            // window.location ="{:U('withdrawCoin')}";
                                                        } else {
                                                            alert(data.msg);
                                                            window.location.reload();
                                                            return;
                                                        }

                                                    }
                                                });
                                            }else{
                                                console.log(err);
                                            }
                                        })
                                    })

                                })

                            }else{
                                console.log(err)
                            }

                        })
                    }else{
                        console.log(error);
                    }

                });
            }
            else
            {
                return;
            }

        });


    </script>

</block>

<block name="js">
    <script>
        var exporturl = "{:U('export_withdraw_coin')}";
        $('#export').click(function () {
            $('form').attr('action',exporturl);
        });


    </script>
</block>